package net.seabookchen.pojo;

import java.util.Date;

import javax.persistence.Id;
import javax.xml.bind.annotation.XmlRootElement;

import net.seabookchen.util.DateUtils;

import com.googlecode.objectify.Key;


@XmlRootElement(name="comment")
public class BlogComment {
	private @Id Long id;
	private String username;
	private String email;
	private String url;
	private String content;
	private Date modifiedDate;
	private Key<BlogPost> post;
	
	public BlogComment() {}

	public BlogComment(String username, String email, String url,
			String content) {
		this.username = username;
		this.email = email;
		this.url = url;
		this.content = content;
		this.modifiedDate = new Date();		
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getModifiedDate() {
		return DateUtils.formatCommentDate(modifiedDate);
	}

	public void setModifiedDate(Date modifiedDate) {
		this.modifiedDate = modifiedDate;
	}

	public Key<BlogPost> getPost() {
		return post;
	}

	public void setPost(Key<BlogPost> post) {
		this.post = post;
	}

	@Override
	public String toString() {
		return "BlogComment [id=" + id + ", username=" + username + ", email="
				+ email + ", Url=" + url + ", content=" + content
				+ ", modifiedDate=" + DateUtils.formatDate(modifiedDate) + ", post=" + post + "]";
	}
	
	
}
